<!DOCTYPE html>
<html
  lang="zh"
  xmlns:th="http://www.thymeleaf.org"
  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
>
  <head>
    <th:block th:include="include :: header('选择党员')" />
  </head>
  <body class="gray-bg">
    <div class="container-div">
      <div class="row">
        <div class="col-sm-12 search-collapse">
          <form id="party-member-form">
            <div class="select-list">
              <ul>
                <li>
                  <label>党员编号：</label>
                  <input type="text" name="partyNo" />
                </li>
                <li>
                  <label>姓名：</label>
                  <input type="text" name="name" />
                </li>
                <li>
                  <<label>政治面貌：</label>
                  <select name="politicalStatus">
                    <option value="">所有</option>
                    <option value="中共党员">中共党员</option>
                    <option value="预备党员">预备党员</option>
                  </select>
                </li>
                <li>
                  <a
                    class="btn btn-primary btn-rounded btn-sm"
                    onclick="$.table.search()"
                    ><i class="fa fa-search"></i>&nbsp;搜索</a
                  >
                  <a
                    class="btn btn-warning btn-rounded btn-sm"
                    onclick="$.form.reset()"
                    ><i class="fa fa-refresh"></i>&nbsp;重置</a
                  >
                </li>
              </ul>
            </div>
          </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
          <table id="bootstrap-table"></table>
        </div>
      </div>
    </div>

    <th:block th:include="include :: footer" />

    <script th:inline="javascript">
      var prefix = ctx + "system/partymember/member";

      $(function () {
        var options = {
          url: prefix + "/list",
          modalName: "党员信息",
          search: false,
          showSearch: false,
          showRefresh: false,
          showToggle: false,
          showColumns: false,
          clickToSelect: true,
          singleSelect: false,
          columns: [
            {
              checkbox: true,
            },
            {
              field: "partyNo",
              title: "党员编号",
              align: "center",
            },
            {
              field: "name",
              title: "姓名",
              align: "center",
            },
            {
              field: "gender",
              title: "性别",
              align: "center",
              formatter: function (value, row, index) {
                if (value == "0") {
                  return "男";
                } else if (value == "1") {
                  return "女";
                }
                return value;
              },
            },
            {
              field: "politicalStatus",
              title: "政治面貌",
              align: "center",
            },
            {
              field: "contactPhone",
              title: "联系电话",
              align: "center",
            },
          ],
        };
        $.table.init(options);
      });

      // 获取选中的数据
      function getSelected() {
        var rows = $.map(
          $("#bootstrap-table").bootstrapTable("getSelections"),
          function (row) {
            return {
              id: row.id,
              name: row.name,
            };
          }
        );
        return rows;
      }
    </script>
  </body>
</html>
